<template>
    <div>count : {{ counter.count }}</div>
    <div>a: {{ counter.a }}</div>
    <div>doubleCount : {{ counter.doubleCount }}</div>
    <button @click="changeCount">修改 count</button>
</template>

<script setup lang="ts">
import { useCounterStore } from '../stores/counter'
let counter = useCounterStore()
console.log(counter);

let changeCount = () => {
    // 1. 通过store实例访问状态来修改和读取实例上数据
    // counter.count++

    // 2. 通过 actions 
    // counter.increment()

    // 3. $patch修改多个state
    counter.$patch({
        count: counter.count + 5,
        a : 2
    })


}


</script>

<style scoped></style>